package com.example.boot.service

import com.example.boot.domain.Settings
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import java.math.BigInteger
import java.util.stream.Stream

@SpringBootTest
class ParameterizedTestDemo {

    @Autowired
    private lateinit var settingsService: SettingsService

    @ParameterizedTest
    @MethodSource("settingArguments")
    fun testRun(settings: Settings) {
        val created = settingsService.createSettings(settings)
        println(created.name)
    }

    companion object {
        @JvmStatic
        fun settingArguments(): Stream<Arguments> =
            Stream.of(
                Arguments.of(Settings(BigInteger.valueOf(1000), "test_name", "test_value")),
                Arguments.of(Settings(BigInteger.valueOf(1001), "test_name1", "test_value1"))
            )
    }
}